
<div class="wap-logo"><img alt="logo" src="<{$logo_image}>"></div>
<form action="<{link app=b2c ctl=wap_passport act=post_login}>" class="form"  method="post" data-type="ajax">
  <input type="hidden" name="forward" value="<{$forward}>">
  <div style=" margin-left:55px;">
      <input type="radio" class="reg_style" name="reg_style" value="0" checked="checked" id="em" onclick="show1()"><label for="em"><{t}>E-mail<{/t}></label>
	  <input type="radio" class="reg_style" name="reg_style" value="1" id="te" onclick="javascript:$('#reg_email').hide();$('#reg_phone').show();$('#reg_phone2').show();" style=" margin-left:20px;"><label for="te"><{t}>Моб.номер<{/t}></label>
  </div>
  
  <div class="c-g" id="reg_phone" style="display:none;">
	<{if $phones}>
	<label class="c-l"><i class="iconfont" title="手机图标">&#xe60b;</i></label>
	<div class="c">
        <select name="phone_setting" id="quhao">
			<{foreach from=$phones item=items}>
			<option sid="<{$items.length}>" value="<{$items.area}>"><{$items.country}><{$items.area}></option>
			<{/foreach}>
		</select>
	</div>
	<{/if}>
  </div>
  
  <{if $close_autocomplete=='true' }>
  <div class="c-g" id="reg_email">
    <label class="c-l"><i class="iconfont">&#xe600;</i></label>
    <div class="c">
	  <{input type="email" signup_type="email" autocomplete="off" name="uname" class="action-account-check text" value="{$loginName}" placeholder=$___b2c="邮箱"|t:'b2c'  data-caution="用户名不能为空" autofocus id="email"}>
    </div>
  </div>
  <div class="c-g" style="display:none;" id="reg_phone2">
    <label class="c-l"><i class="iconfont">&#xe60b;</i></label>
    <div class="c">
	  <{input type="text" name="pam_account[login_mobile]" placeholder=$___b2c="请填写手机号"|t:'b2c'  id="check_tel" class="text"}><span  style="color:red" class="validation-messagebox" id="phoneid"></span></span>
    </div>
  </div>
  <{else}>
  <div class="c-g" id="reg_email">
    <label class="c-l"><i class="iconfont">&#xe600;</i></label>
    <div class="c">
	  <{input type="email" signup_type="email" autocomplete="off" name="uname" class="action-account-check text" value="{$loginName}" placeholder=$___b2c="邮箱"|t:'b2c'  data-caution="用户名不能为空" autofocus id="email"}>
    </div>
  </div>
  <div class="c-g" style="display:none;" id="reg_phone2">
    <label class="c-l"><i class="iconfont">&#xe60b;</i></label>
    <div class="c">
	  <{input type="text" name="pam_account[login_mobile]" placeholder=$___b2c="请填写手机号"|t:'b2c'  id="check_tel" class="text"}><span  style="color:red" class="validation-messagebox" id="phoneid"></span></span>
    </div>
  </div>
  <{/if}>
  <div class="c-g a-need-verify" style="display:none;">
    <label for="" class="c-l"><i class="iconfont" title="验证码">&#xe609;</i></label>
    <div class="c">
      <input type="text" name="mobileVcode" id="" placeholder="<{t}>填写验证码<{/t}>" class="text"><a href="<{link app=b2c ctl=wap_passport act=send_vcode_sms}>" class="btn orange ib-btn btn-send"><span><span><{t}>获取验证码<{/t}></span></span></a>
    </div>
  </div>
  <div class="c-g">
    <label class="c-l"><i class="iconfont" title="密码">&#xe601;</i></label>
    <div class="c">
      <input type="password" name="password" placeholder="<{t}>填写密码<{/t}>" class="text" required="required" data-caution="<{t}>密码不能为空<{/t}>">
    </div>
  </div>

  <{if $show_varycode}>
  <div class="c-g">
    <label class="c-l"><i class="iconfont" title="验证码">&#xe609;</i></label>
    <div class="c">
      <{input type="vcode" name="verifycode" class="verify-input" placeholder=$___b2c="填写验证码"|t:'b2c' key='b2c' label=$___b2c="换一张"|t:'b2c'}>
    </div>
  </div>
  <{/if}>

  <div class="c-g-c c-fix">
    <label class="f-l">
      <input type="checkbox" name="is_remember" <{if $site_b2c_remember != '0'}> checked="checked"<{/if}> >
      <{t}>记住我<{/t}>
    </label>
    <a href="<{link app=b2c ctl=wap_passport act=lost}>" class="f-r lnk"><{t}>忘记密码<{/t}></a>
  </div>
  <div class="btn-bar">
    <button type="submit" class="btn orange" rel="_request"><{t}>登录<{/t}></button>
  </div>
</form>
<script>
$('.form .a-account').change(function(e) {
    if(/^1[3458]\d{9}$/.test(this.value)) {
        $.post('<{link app=b2c ctl=wap_passport act=login_ajax_account}>', this.name + '=' + this.value, function(rs){
            if(rs) {
                try{
                    rs = $.parseJSON(rs);
                } catch (e) {}
                if(rs.error) {
                    if(typeof rs.error === 'string') alert(rs.error);
                }
                else if(rs.needVerify === 'true') {
                    $('.form .a-need-verify').show();
                }
            }
        });
        // alert('您的手机号码还未通过验证，点击进行验证');
    }
    else {
        $('.form .a-need-verify').hide();
    }
});

$('.form .btn-send').click(function (e) {
    e.preventDefault();
    var el = $('.form .a-account');
    if($(this).hasClass('disabled')) return false;
    sendVerify(this, el.attr('name') + '=' + el.val() + '&type=activation');
});

function sendVerify(el, data) {
    var url = el.href;
    $(el).addClass('disabled');
    var cd = new countdown(el, {
        start: 120,
        secondOnly: true,
        callback: function(e) {
            $(el).removeClass('disabled').html('<{t}>重发密码<{/t}>');
        }
    });
    $.post(url, data, function(rs) {
        if(rs) {
            try{
                rs = $.parseJSON(rs);
            } catch (e) {}
            if(rs.error) {
                $(el).removeClass('disabled').html('<{t}>重发密码<{/t}>');
                clearTimeout(cd.timer);
                if(typeof rs.error === 'string') alert(rs.error);
            }
        }
    });
}

function show1(){
	$('#reg_email').show();
	$('#reg_phone').hide();
	$('#reg_phone2').hide();
}
</script>
